package com.scy.boot06.controller;

import com.scy.boot06.entity.Product;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class AxiosController {

    @RequestMapping("/helloAxios")
    public String helloAxios( String name,int age){
        return "测试成功"+name+":"+age;
    }
    @RequestMapping("/postAxios")
//    @RequestBody 如果是异步请求并且提交的参数时自定义的js对象 服务器接收参数时必须添加@RequestBody注解
    public String postAxios(@RequestBody Product product){
        System.out.println("product = " + product);
        return "post测试成功";
    }
}
